<template>
  <view class="child-item  pt-[30px]" :class="{ isShow }">
    <view class="flex items-center w-[100%] px-[30px] flex-1 overflow-hidden	justify-center ">
		<image class="pic" :src="item.cover" mode="widthFix" :style="{width: item.width && (item.width+'px')}" @load="load" @error="load" lazy-load/>
	</view>
    <view class="info flex-shrink-0">{{ item.name }}</view>
	<image src="@/assets/images/list-border.png" class="img-border"></image>
  </view>
</template>

<script setup>
  import { ref } from 'vue'
  defineProps({
    item: {
      type: Object,
      default: () => ({})
    }
  })

  const isShow = ref(false)

  const emit = defineEmits(['load', 'error'])

  function load(e) {
    isShow.value = true
    emit('load', e)
  }
</script>

<style lang="scss" scoped>
  .child-item {
    position: relative;
    font-size: 0;
    border-radius: 10px;
    margin-bottom: 26px;
    overflow: hidden;
    transition: all ease 0.35s;
    opacity: 0;
	background: #D1C4B1;
	border-radius: 12px;
	min-height: 400px;
	
	display:flex;
	flex-direction: column;
	
	.img-border {
		width: calc(100% - 40px);
		height: calc(100% - 36px);
		position: absolute;
		top: 20px;
		left: 20px;
		// background: url('@/assets/images/list-border.png') no-repeat;
		// background-size: 100% 100%;
	}
	.pic{
		margin-top: 10px;
		max-width: calc(100% - 40px);
		
		margin-bottom: 10px;
		object-fit: contain;
	}

    .info {
	  padding:  0 61px;
	  white-space: nowrap;
	  text-overflow: ellipsis;
	  overflow: hidden;
	  height: 80px;
	  font-size: 32px;
	  line-height: 70px;
	  color: #000000;
      background: #F7F2EA;
    }
    &.isShow {
      opacity: 1;
    }
  }
</style>
